﻿<Controls:SinacorWindow  
          x:Class="Sinacor.UI.Bovespa.ManutencaoOrdens.View.SmartClient.ConsultaGeralOrdensNegocios" 
          xmlns:Local="clr-namespace:Sinacor.UI.Bovespa.ManutencaoOrdens.View.SmartClient"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  
          xmlns:Custom="http://schemas.xceed.com/wpf/xaml/datagrid"
          xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
          mc:Ignorable="d"
          xmlns:Model="clr-namespace:Sinacor.UI.Bovespa.ManutencaoOrdens.Model;assembly=Sinacor.UI.Bovespa.ManutencaoOrdens.Model"
          xmlns:Model2="clr-namespace:Sinacor.UI.Bovespa.ManutencaoOrdens.View.SmartClient"
          xmlns:Controls="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient;assembly=Sinacor.Infra.UI.Controls"
          xmlns:DataGrid="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient.DataGrid;assembly=Sinacor.Infra.UI.Controls"               
          xmlns:Validation="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient.Validation;assembly=Sinacor.Infra.UI.Controls"
          WindowStartupLocation="CenterScreen"
          AutoContentHeight="True" 
          AutoContentWidth="True"
          WindowState="Maximized" 
          Title="{DynamicResource Bovespa.ManutencaoOrdens.Label.ConsultaGeralOrdensNegocios}" 
          ModulePlus="True"
          ModuleId="ORD">

    <Controls:SinacorDragDrop x:Name="dragDrop" QueryContinueDrag="dragDrop_QueryContinueDrag">

        <Controls:SinacorExplorer x:Name="explorer" SelectedViewChanged="explorer_SelectedViewChanged" IsItemDetailsVisible="True" >

            <!-- TreeView -->
            <Controls:SinacorExplorer.Groups>
                <Controls:SinacorTreeView x:Name="treeView" 
                                          ItemsSource="{Binding TreeViewConsultaGeral}" 
                                          Controls:SinacorDragDrop.IsDragSource="True"
                                          Controls:SinacorDragDrop.IsDropTarget="True"                                        
                                          BufferedSelectionChanged="treeView_BufferedSelectionChanged"                                       
                                          DragOver="treeView_DragOver"
                                          Drop="treeView_Drop">

                    <!-- Template dos ToggleButtons do TreeView -->
                    <Controls:SinacorTreeView.ToggleButtonTemplate>
                        <DataTemplate>
                            <Controls:SinacorTreeViewToggleButton Style="{DynamicResource FolderTreeViewToggleButton}">

                                <!-- Altera o icone dos items sem filhos -->
                                <Controls:SinacorTreeViewToggleButton.EmptyStateTemplate>
                                    <DataTemplate>
                                        <Rectangle x:Name="IconTreeView" Style="{DynamicResource FolderDisabled}" />
                                        <DataTemplate.Triggers>

                                            <!-- DataTrigger Casado -->
                                            <DataTrigger Binding="{Binding DataContext.SituacaoCasamento.Value, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorTreeViewItem}}}" Value="Casada">
                                                <Setter Property="Style" Value="{DynamicResource MatchedTrade}" TargetName="IconTreeView" />
                                            </DataTrigger>
                                            <!-- DataTrigger NaoCasado -->
                                            <DataTrigger Binding="{Binding DataContext.SituacaoCasamento.Value, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorTreeViewItem}}}" Value="NaoCasada">
                                                <Setter Property="Style" Value="{DynamicResource NotMatchedTrade}" TargetName="IconTreeView" />
                                            </DataTrigger>
                                            <!-- DataTrigger ParcialmenteCasada -->
                                            <DataTrigger Binding="{Binding DataContext.SituacaoCasamento.Value, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorTreeViewItem}}}" Value="ParcialmenteCasada">
                                                <Setter Property="Style" Value="{DynamicResource PartiallyMatchedTrade}" TargetName="IconTreeView" />
                                            </DataTrigger>

                                        </DataTemplate.Triggers>
                                    </DataTemplate>
                                </Controls:SinacorTreeViewToggleButton.EmptyStateTemplate>

                            </Controls:SinacorTreeViewToggleButton>
                        </DataTemplate>
                    </Controls:SinacorTreeView.ToggleButtonTemplate>


                    <Controls:SinacorTreeView.ItemTemplate>
                        <HierarchicalDataTemplate ItemsSource="{Binding Children}">
                            <Controls:SinacorLabel x:Name="LblDadosTreeView" 
                                                   Content="{Binding Text}" />
                        </HierarchicalDataTemplate>
                    </Controls:SinacorTreeView.ItemTemplate>

                    <Controls:SinacorTreeView.ContextMenu>
                        <Controls:SinacorContextMenu>

                            <Controls:SinacorContextMenuItem Name="menuDataPregao"
                                                                             Header="{DynamicResource Bovespa.Ordens.Label.ConsultarData}"
                                                                            Click="menuDataPregao_Click"
                                                                            Loaded="menuDataPregao_Loaded"/>
                        </Controls:SinacorContextMenu>
                    </Controls:SinacorTreeView.ContextMenu>
                </Controls:SinacorTreeView>
            </Controls:SinacorExplorer.Groups>

            <!-- Items selecionados do TreeView -->
            <Controls:SinacorExplorer.NavigationPath>
                <Controls:SinacorNavigationPath x:Name="navigationPath" 
                                                DisplayMemberPath="Text" 
                                                ItemsSource="{Binding Groups.SelectedPath, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorExplorer}}}" />
            </Controls:SinacorExplorer.NavigationPath>

            <!-- Visualizações -->
            <Controls:SinacorExplorer.Views>

                <!-- Visualização por lista -->
                <Controls:ExplorerListView>

                    <Controls:ExplorerListView.Resources>

                        <DataTemplate DataType="{x:Type Model:NoOrdem}">
                            <StackPanel Orientation="Horizontal">
                                <Rectangle x:Name="Icon" Style="{DynamicResource FolderCollapsed}" />
                                <Controls:SinacorLabel Content="{Binding NumeroOrdem}" />
                                <Controls:SinacorLabel Content="/" />
                                <Controls:SinacorLabel Content="{Binding NumeroOrdemSubSequencia}" />
                            </StackPanel>
                            <DataTemplate.Triggers>
                                <!-- DataTrigger Casado -->
                                <DataTrigger Binding="{Binding SituacaoCasamento.Value}" Value="Casada">
                                    <Setter Property="Style" Value="{DynamicResource MatchedTrade}" TargetName="Icon" />
                                </DataTrigger>
                                <!-- DataTrigger NaoCasado -->
                                <DataTrigger Binding="{Binding SituacaoCasamento.Value}" Value="NaoCasada">
                                    <Setter Property="Style" Value="{DynamicResource NotMatchedTrade}" TargetName="Icon" />
                                </DataTrigger>
                                <!-- DataTrigger ParcialmenteCasada -->
                                <DataTrigger Binding="{Binding SituacaoCasamento.Value}" Value="ParcialmenteCasada">
                                    <Setter Property="Style" Value="{DynamicResource PartiallyMatchedTrade}" TargetName="Icon" />
                                </DataTrigger>
                            </DataTemplate.Triggers>
                        </DataTemplate>


                        <DataTemplate DataType="{x:Type Model:NoNegocio}">
                            <StackPanel Orientation="Horizontal">
                                <Rectangle x:Name="Icon" Style="{DynamicResource FolderCollapsed}" />
                                <Controls:SinacorLabel Content="{Binding Numero}" />
                            </StackPanel>
                            <DataTemplate.Triggers>
                                <!-- DataTrigger Casado -->
                                <DataTrigger Binding="{Binding SituacaoCasamento.Value}" Value="Casada">
                                    <Setter Property="Style" Value="{DynamicResource MatchedTrade}" TargetName="Icon" />
                                </DataTrigger>
                                <!-- DataTrigger NaoCasado -->
                                <DataTrigger Binding="{Binding SituacaoCasamento.Value}" Value="NaoCasada">
                                    <Setter Property="Style" Value="{DynamicResource NotMatchedTrade}" TargetName="Icon" />
                                </DataTrigger>
                                <!-- DataTrigger ParcialmenteCasada -->
                                <DataTrigger Binding="{Binding SituacaoCasamento.Value}" Value="ParcialmenteCasada">
                                    <Setter Property="Style" Value="{DynamicResource PartiallyMatchedTrade}" TargetName="Icon" />
                                </DataTrigger>
                            </DataTemplate.Triggers>
                        </DataTemplate>
                    </Controls:ExplorerListView.Resources>


                    <Controls:SinacorListView x:Name="listView" 
                                              Controls:SinacorDragDrop.IsDragSource="True"
                                              Controls:SinacorDragDrop.IsDropTarget="True"                                           
                                              Drop="itemsView_Drop">
                    </Controls:SinacorListView>
                </Controls:ExplorerListView>

                <!-- Visualização por detalhes exibe a Ordens ou a Negocios-->
                <Controls:ExplorerDetailsView>
                    <Grid>
                        <DataGrid:SinacorDataGrid x:Name="detailsViewOrdens"                                                
                                              Controls:SinacorDragDrop.IsDragSource="True"
                                              Controls:SinacorDragDrop.IsDropTarget="True"
                                              BufferedSelectionChanged="detailsViewOrdens_BufferedSelectionChanged"
                                              ApplyingStyle="detailsViewOrdens_ApplyingStyle"
                                                  EnableColumnVirtualization="False"
                                              Drop="itemsView_Drop">


                            <DataGrid:SinacorDataGrid.ContextMenuTemplate>
                                <DataTemplate>
                                    <StackPanel>
                                        <Controls:SinacorContextMenuItem Name="menuDtgOrdensMostrarNeg"
                                                                             Header="{DynamicResource Bovespa.Ordens.Label.MostrarNegocios}"
                                                                            Click="menuDtgOrdensMostrarNeg_Click"
                                                                            Loaded="menuDtgOrdensMostrarNeg_Loaded"/>
                                        <Controls:SinacorContextMenuItem Name="menuDtgOrdensMostrarPreBol"
                                                                             Header="{DynamicResource Bovespa.Ordens.Label.MostrarPreBoletos}"
                                                                            Click="menuDtgOrdensMostrarPreBol_Click"
                                                                            Loaded="menuDtgOrdensMostrarPreBol_Loaded"/>
                                        <Controls:SinacorContextMenuItem Name="menuDtgOrdensManutOrd"
                                                                             Header="{DynamicResource Bovespa.Ordens.Label.ManutOrdens}"
                                                                            Click="menuDtgOrdensManutOrd_Click"
                                                                            Loaded="menuDtgOrdensManutOrd_Loaded"/>
                                        <Controls:SinacorContextMenuItem Name="menuDtgOrdensCancelOrd"
                                                                             Header="{DynamicResource Bovespa.Ordens.Label.CancOrdem}"
                                                                            Click="menuDtgOrdensCancelOrd_Click"
                                                                            Loaded="menuDtgOrdensCancelOrd_Loaded"/>

                                    </StackPanel>
                                </DataTemplate>
                            </DataGrid:SinacorDataGrid.ContextMenuTemplate>


                            <DataGrid:SinacorDataGrid.Columns>
                                <DataGrid:DataGridTextColumn Name="Data" 
                                                             HorizontalCellAlignment="Center"
                                                             Binding="{Binding Path=DataOrdem, StringFormat=d}"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Data}"/>
                                <DataGrid:DataGridTextColumn Name="Numero" 
                                                             Binding="{Binding Path=NumeroOrdem}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Numero}"/>
                                <DataGrid:DataGridTextColumn Name="Subseq"
                                                             HorizontalCellAlignment="Right"
                                                             Binding="{Binding Path=NumeroOrdemSubSequencia}"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Subseq}"/>
                                <DataGrid:DataGridEnumColumn Name="Sit." 
                                                             Binding="{Binding Path=Situacao.Text}"
                                                             HorizontalCellAlignment="Left"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Sit}"/>

                                <DataGrid:DataGridTemplateColumn Name="Bolsa" Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Bolsa}">
                                    <DataGrid:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Horizontal">
                                                <Controls:SinacorLabel Content="{Binding NomeBolsa}" />
                                            </StackPanel>
                                        </DataTemplate>
                                    </DataGrid:DataGridTemplateColumn.CellTemplate>
                                </DataGrid:DataGridTemplateColumn>


                                <DataGrid:DataGridTextColumn Name="Quantidade" HorizontalCellAlignment="Right"
                                                             Binding="{Binding Path=Quantidade}"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Quantidade}"/>
                                <DataGrid:DataGridEnumColumn Name="Tipo Liq." 
                                                             Binding="{Binding Path=TipoLiquidacao.Text}"
                                                             HorizontalCellAlignment="Left"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.TipoLiq}"/>
                                <DataGrid:DataGridTextColumn Name="Carteira" 
                                                             Binding="{Binding Path=Carteira}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Carteira}"/>
                                <DataGrid:DataGridTextColumn Name="PercAcrRed" 
                                                             Binding="{Binding Path=PercentualCorretagem}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.PercAcrRed}"/>
                                <DataGrid:DataGridTextColumn Name="Broker" 
                                                             Binding="{Binding Path=CodigoBrokerCliente}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Broker}"/>
                                <DataGrid:DataGridTextColumn Name="QuantCasada" 
                                                             Binding="{Binding Path=QuantidadeExecutada}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.QtdCasada}"/>
                                <DataGrid:DataGridTextColumn Name="Preco" 
                                                             Binding="{Binding Path=Preco}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Preco}"/>
                                <DataGrid:DataGridTextColumn Name="Validade" 
                                                             Binding="{Binding Path=DataValidade, StringFormat=d}"
                                                             HorizontalCellAlignment="Center"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Validade}"/>
                                <DataGrid:DataGridEnumColumn Name="Tipo" 
                                                             Binding="{Binding Path=TipoOrdem.Text}"
                                                             HorizontalCellAlignment="Left"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Tipo}"/>
                                <DataGrid:DataGridTextColumn Name="Emissor" 
                                                             HorizontalCellAlignment="Left"
                                                             Binding="{Binding Path=NomeEmissor}"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Emissor}"/>
                                <DataGrid:DataGridTextColumn Name="Operador"
                                                             Binding="{Binding Path=CodigoOperador}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Operador}"/>
                                <DataGrid:DataGridTextColumn Name="ValorFinanc" 
                                                             Binding="{Binding Path=ValorFinanciamento}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.ValorFinanc}"/>
                                <DataGrid:DataGridTextColumn Name="PercFinanc" 
                                                             Binding="{Binding Path=PercentualFinanciamento}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.PercFinanc}"/>
                                <DataGrid:DataGridTextColumn Name="VctoTermo" 
                                                             Binding="{Binding Path=PrazoVencimentoTermo}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.VctoTermo}"/>
                                <DataGrid:DataGridEnumColumn Name="Mercado" 
                                                             Binding="{Binding Path=Mercado.Text}"
                                                             HorizontalCellAlignment="Left"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Mercado}"/>

                                <DataGrid:DataGridTemplateColumn HorizontalCellAlignment="Center" Name="AdmConc" Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.AdmConc}">
                                    <DataGrid:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                                <Controls:SinacorCheckBox HorizontalAlignment="Center" IsChecked="{Binding Path=IndicadorOrdemAdmConcorrente}" IsEnabled="False"/>
                                            </StackPanel>
                                        </DataTemplate>
                                    </DataGrid:DataGridTemplateColumn.CellTemplate>
                                </DataGrid:DataGridTemplateColumn>


                                <DataGrid:DataGridTemplateColumn HorizontalCellAlignment="Center" Name="PesVinc" Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.PesVinc}">
                                    <DataGrid:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Horizontal">
                                                <Controls:SinacorCheckBox HorizontalAlignment="Center" IsChecked="{Binding Path=IndicadorClientePessoaVinculada}" IsEnabled="False"/>
                                            </StackPanel>
                                        </DataTemplate>
                                    </DataGrid:DataGridTemplateColumn.CellTemplate>
                                </DataGrid:DataGridTemplateColumn>


                                <DataGrid:DataGridTemplateColumn HorizontalCellAlignment="Center" Name="DesprezaSaldo" Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.DesprezaSaldo}">
                                    <DataGrid:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Horizontal">
                                                <Controls:SinacorCheckBox HorizontalAlignment="Center" IsChecked="{Binding Path=IndicadorDesprezaSaldo}" IsEnabled="False" />
                                            </StackPanel>
                                        </DataTemplate>
                                    </DataGrid:DataGridTemplateColumn.CellTemplate>
                                </DataGrid:DataGridTemplateColumn>



                            </DataGrid:SinacorDataGrid.Columns>
                        </DataGrid:SinacorDataGrid>

                        <DataGrid:SinacorDataGrid x:Name="detailsViewNegocios"
                                                  Controls:SinacorDragDrop.IsDragSource="True"
                                                  Controls:SinacorDragDrop.IsDropTarget="True"
                                                  Visibility="Collapsed"                                                                                                    
                                                  ApplyingStyle="detailsViewNegocios_ApplyingStyle"
                                                  EnableColumnVirtualization="False"
                                                  Drop="itemsView_Drop">

                            <DataGrid:SinacorDataGrid.ContextMenuTemplate>
                                <DataTemplate>
                                    <StackPanel>
                                        <Controls:SinacorContextMenuItem Name="menuDtgNegAlteracaoNegocio"
                                                                             Header="{DynamicResource Bovespa.Ordens.Label.AlteracaoNegocio}"
                                                                            Click="menuDtgNegAlteracaoNegocio_Click"
                                                                            Loaded="menuDtgNegAlteracaoNegocio_Loaded"/>
                                        <Controls:SinacorContextMenuItem Name="menuDtgNegCancelarNegocio"
                                                                             Header="{DynamicResource Bovespa.Ordens.Label.CancelarNegocio}"
                                                                            Click="menuDtgNegCancelarNegocio_Click"
                                                                            Loaded="menuDtgNegCancelarNegocio_Loaded"/>
                                    </StackPanel>
                                </DataTemplate>
                            </DataGrid:SinacorDataGrid.ContextMenuTemplate>


                            <DataGrid:SinacorDataGrid.Columns>
                                <DataGrid:DataGridTextColumn Name="Data"                                                              
                                                             Binding="{Binding Path=DataPregao, StringFormat={}\{0:d\}}"
                                                             HorizontalCellAlignment="Center"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Data}"/>
                                <DataGrid:DataGridTextColumn Name="Hora"                                                              
                                                             Binding="{Binding Path=HoraNegocio, StringFormat=t}"
                                                             HorizontalCellAlignment="Center"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Hora}"/>
                                <DataGrid:DataGridTextColumn Name="Bolsa" 
                                                             Binding="{Binding Path=Bolsa}"
                                                             HorizontalCellAlignment="Center"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Bolsa}"/>
                                <DataGrid:DataGridTextColumn Name="Numero" 
                                                             Binding="{Binding Path=Numero}"
                                                             HorizontalCellAlignment="Center"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Numero}"/>
                                <DataGrid:DataGridTextColumn Name="Contraparte" 
                                                             Binding="{Binding Path=ContraParte}"
                                                             HorizontalCellAlignment="Center"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Contraparte}"/>
                                <DataGrid:DataGridEnumColumn Name="Natureza" 
                                                             Binding="{Binding Path=NaturezaOperacao.Text}"
                                                             HorizontalCellAlignment="Center"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Natureza}"                                                             
                                                             />
                                <DataGrid:DataGridEnumColumn Name="Mercado" 
                                                             Binding="{Binding Path=Mercado.Text}"
                                                             HorizontalCellAlignment="Center"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Mercado}"/>
                                <DataGrid:DataGridTextColumn Name="Ativo" 
                                                             Binding="{Binding Path=Codigo}"
                                                             HorizontalCellAlignment="Center"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Ativo}"/>
                                <DataGrid:DataGridTextColumn Name="Quantidade" 
                                                             Binding="{Binding Path=Quantidade}"
                                                             HorizontalCellAlignment="Center"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Quantidade}"/>
                                <DataGrid:DataGridTextColumn Name="Preco" 
                                                             Binding="{Binding Path=Preco}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Preco}"/>
                                <DataGrid:DataGridTextColumn Name="QuantCasada" 
                                                             Binding="{Binding Path=QuantidadeCasada}"
                                                             HorizontalCellAlignment="Center"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.QtdCasada}"/>
                                <DataGrid:DataGridTextColumn Name="Operador" 
                                                             Binding="{Binding Path=Operador}"
                                                             HorizontalCellAlignment="Center"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Operador}"/>
                            </DataGrid:SinacorDataGrid.Columns>
                        </DataGrid:SinacorDataGrid>
                    </Grid>

                </Controls:ExplorerDetailsView>

            </Controls:SinacorExplorer.Views>

            <!-- Detalhes -->
            <Controls:SinacorExplorer.ItemDetails>
                <Controls:SinacorExpanderContainer>
                    <Controls:SinacorExpanderContainer.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                    </Controls:SinacorExpanderContainer.ColumnDefinitions>

                    <Controls:SinacorExpander Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.ExecucoesOrdem}" 
                                                         Name="expExecucoesOrdem"
														VerticalAlignment="Stretch" 
														Grid.Column="0" 
														IsExpanded="True"
								  						AllowExpand="False"
                                                        Visibility="Hidden">
                        <!-- DtgExecsOrdem -->
                        <DataGrid:SinacorDataGrid x:Name="DtgExecsOrdem"
                                                  ItemsSource="{Binding NegociosExecutados}"
                                                  EnableColumnVirtualization="False"
                                                  ApplyingStyle="DtgExecsOrdem_ApplyingStyle"
                                                  
                                                  Controls:SinacorDragDrop.IsDragSource="True"
                                                  Controls:SinacorDragDrop.IsDropTarget="True"
                                                  Drop="DtgExecsOrdem_Drop"
                                                  >

                            <DataGrid:SinacorDataGrid.ContextMenuTemplate>
                                <DataTemplate>
                                    <StackPanel>
                                        <Controls:SinacorContextMenuItem Name="menuDtgExecsOrdemDescasar"
                                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.EfetuarDescasamento}"
                                                                            Click="menuDtgExecsOrdemDescasar_Click"
                                                                            Loaded="menuDtgExecsOrdemDescasar_Loaded"/>
                                    </StackPanel>
                                </DataTemplate>
                            </DataGrid:SinacorDataGrid.ContextMenuTemplate>


                            <DataGrid:SinacorDataGrid.Columns>
                                <DataGrid:DataGridTextColumn Name="Data"  
                                                             Binding="{Binding Path=Ordem.DataOrdem, StringFormat={}\{0:d\}}"
                                                             HorizontalCellAlignment="Center"                                                             
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Data}"/>
                                <DataGrid:DataGridTextColumn Name="Ordem" 
                                                             Binding="{Binding Path=Ordem.NumeroOrdem, StringFormat='###,###,###'}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Ordem}"/>
                                <DataGrid:DataGridTextColumn Name="Sequencia" 
                                                             Binding="{Binding Path=Ordem.NumeroOrdemSubSequencia, StringFormat='##,##0'}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Sequencia}"/>
                                <DataGrid:DataGridTextColumn Name="Ativo" 
                                                             Binding="{Binding Path=Codigo}"
                                                             HorizontalCellAlignment="Left"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Ativo}"/>
                                <DataGrid:DataGridEnumColumn Name="Natureza" 
                                                             Binding="{Binding Path=NaturezaOperacao.Text}"
                                                             HorizontalCellAlignment="Left"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Natureza}"/>
                                <DataGrid:DataGridTextColumn Name="Negocio" 
                                                             Binding="{Binding Path=Numero, StringFormat='###,###,###'}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Negocio}"/>
                                <DataGrid:DataGridTextColumn Name="Quantidade" 
                                                             Binding="{Binding Path=Quantidade, StringFormat='###,###,###,##0.0000'}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Quantidade}"/>
                                <DataGrid:DataGridTextColumn Name="Preco" 
                                                             Binding="{Binding Path=Preco, StringFormat='#,###,##0.00000000'}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Preco}"/>
                                <DataGrid:DataGridTextColumn Name="Bolsa" 
                                                             Binding="{Binding Path=Bolsa}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Bolsa}"/>
                                <DataGrid:DataGridTextColumn Name="Operador" 
                                                             Binding="{Binding Path=Operador}"
                                                             HorizontalCellAlignment="Left"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Operador}"/>
                            </DataGrid:SinacorDataGrid.Columns>
                        </DataGrid:SinacorDataGrid>
                    </Controls:SinacorExpander>

                    <Controls:SinacorExpander Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.NegociosNaoCasados}" 
                                              Name="expNegociosNaoCasados"
											  VerticalAlignment="Stretch" 
										      Grid.Column="1" 
											  IsExpanded="True" 
											  Margin="4,0,0,0"
								  			  AllowExpand="False"
                                              Visibility="Hidden">
                        <!-- DtgNegNaoCasados-->
                        <DataGrid:SinacorDataGrid x:Name="DtgNegNaoCasados"
                                                  ItemsSource="{Binding NegociosDisponiveis}"
                                                  EnableColumnVirtualization="False"
                                                  ApplyingStyle="DtgNegNaoCasados_ApplyingStyle"
                                                  
                                                  Controls:SinacorDragDrop.IsDragSource="True"
                                                  Controls:SinacorDragDrop.IsDropTarget="True"   
                                                  Drop="DtgNegNaoCasados_Drop">


                            <DataGrid:SinacorDataGrid.ContextMenuTemplate>
                                <DataTemplate>
                                    <StackPanel>
                                        <Controls:SinacorContextMenuItem Name="menuDtgNegNaoCasados"
                                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.EfetuarCasamento}"
                                                                            Click="menuDtgNegNaoCasados_Click"
                                                                            Loaded="menuDtgNegNaoCasados_Loaded"/>
                                    </StackPanel>
                                </DataTemplate>
                            </DataGrid:SinacorDataGrid.ContextMenuTemplate>

                            <DataGrid:SinacorDataGrid.Columns>
                                <DataGrid:DataGridTextColumn Name="Data" 
                                                             Binding="{Binding Path=DataPregao, StringFormat={}\{0:d\}}"
                                                             HorizontalCellAlignment="Center"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Data}"/>
                                <DataGrid:DataGridTextColumn Name="Numero" 
                                                             Binding="{Binding Path=Numero , StringFormat='###,###,###'}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Numero}"/>
                                <DataGrid:DataGridEnumColumn Name="Mercado" 
                                                             Binding="{Binding Path=Mercado.Text}"
                                                             HorizontalCellAlignment="Left"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Mercado}"/>
                                <DataGrid:DataGridTextColumn Name="Ativo" 
                                                             Binding="{Binding Path=Codigo}"
                                                             HorizontalCellAlignment="Left"                                                             
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Ativo}"/>
                                <DataGrid:DataGridEnumColumn Name="Natureza" 
                                                             HorizontalCellAlignment="Left"
                                                             Binding="{Binding Path=NaturezaOperacao.Text}"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Natureza}"/>
                                <DataGrid:DataGridTextColumn Name="Quantidade" 
                                                             HorizontalCellAlignment="Right"
                                                             Binding="{Binding Path=Quantidade, StringFormat='###,###,##0.0000'}"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Quantidade}"
                                                             />
                                <DataGrid:DataGridTextColumn Name="Saldo" 
                                                             HorizontalCellAlignment="Right"
                                                             Binding="{Binding Path=Saldo, StringFormat='###,###,##0.0000'}"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Saldo}"/>
                                <DataGrid:DataGridTextColumn Name="Preco" 
                                                             HorizontalCellAlignment="Right"
                                                             Binding="{Binding Path=Valor, StringFormat='#,###,##0.00000000'}"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Preco}"/>
                                <DataGrid:DataGridTextColumn Name="Bolsa" 
                                                             HorizontalCellAlignment="Right"
                                                             Binding="{Binding Path=Bolsa}"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Bolsa}"/>
                                <DataGrid:DataGridTextColumn Name="Operador" 
                                                             HorizontalCellAlignment="Left"
                                                             Binding="{Binding Path=Operador}"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Operador}"/>
                            </DataGrid:SinacorDataGrid.Columns>
                        </DataGrid:SinacorDataGrid>
                    </Controls:SinacorExpander>

                    <Controls:SinacorExpander Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.PreBoletos}" 
                                              Name="expPreBoletos"
										      VerticalAlignment="Stretch"
										      IsExpanded="True"
								  		      AllowExpand="False"
                                              Grid.ColumnSpan="2"
                                              Visibility = "Collapsed">
                        <!-- DtgPreBoletos-->
                        <DataGrid:SinacorDataGrid x:Name="DtgPreBoletos"
                                                  ItemsSource="{Binding PreBoletos}"
                                                  EnableColumnVirtualization="False"
                                                  ApplyingStyle="DtgPreBoletos_ApplyingStyle"
                                                  Visibility="Collapsed">


                            <DataGrid:SinacorDataGrid.ContextMenuTemplate>
                                <DataTemplate>
                                    <StackPanel>
                                        <Controls:SinacorContextMenuItem Name="menuPreBoletosCasamento"
                                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.EfetuarCasamento}"
                                                                            Click="menuPreBoletosCasamento_Click"
                                                                            Loaded="menuPreBoletosCasamento_Loaded"/>
                                        <Controls:SinacorContextMenuItem Name="menuPreBoletosExcluir"
                                                                             Header="{DynamicResource Bovespa.Ordens.Label.Excluir }"
                                                                            Click="menuPreBoletosExcluir_Click"
                                                                            Loaded="menuPreBoletosExcluir_Loaded"/>
                                    </StackPanel>
                                </DataTemplate>
                            </DataGrid:SinacorDataGrid.ContextMenuTemplate>


                            <DataGrid:SinacorDataGrid.Columns>
                                <DataGrid:DataGridTextColumn Name="QtdeNegocio" 
                                                             Binding="{Binding Path=Quantidade, StringFormat='###,###,##0.0000'}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.QtdeNegocio}"/>
                                <DataGrid:DataGridTextColumn Name="Preco" 
                                                             Binding="{Binding Path=Preco, StringFormat='#,###,##0.00000000'}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Preco}"/>
                                <DataGrid:DataGridTextColumn Name="CParte" 
                                                             Binding="{Binding Path=ContraParte}"
                                                             HorizontalCellAlignment="Left"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.CParte}"/>
                                <DataGrid:DataGridEnumColumn Name="Casamento" 
                                                             Binding="{Binding Path=Casamento.Text}"
                                                             HorizontalCellAlignment="Left"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Casamento}"/>
                                <DataGrid:DataGridTextColumn Name="QtdCasada" 
                                                             Binding="{Binding Path=QuantidadeCasada, StringFormat='###,###,##0.0000'}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.QtdCasada}"/>
                                <DataGrid:DataGridEnumColumn Name="Estrategia" 
                                                             Binding="{Binding Path=Estrategia.Text}"
                                                             HorizontalCellAlignment="Left"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Estrategia}"/>
                                <DataGrid:DataGridTextColumn Name="Cambio" 
                                                             Binding="{Binding Path=ValorCambio, StringFormat='#,##0.000000'}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.Cambio}"/>
                                <DataGrid:DataGridTextColumn Name="VolumeCambio" 
                                                             Binding="{Binding Path=Volume, StringFormat='##,###,##0.00'}"
                                                             HorizontalCellAlignment="Right"
                                                             Header="{DynamicResource Bovespa.ManutencaoOrdens.Label.VolumeCambio}"/>
                            </DataGrid:SinacorDataGrid.Columns>
                        </DataGrid:SinacorDataGrid>
                    </Controls:SinacorExpander>

                </Controls:SinacorExpanderContainer>

            </Controls:SinacorExplorer.ItemDetails>

        </Controls:SinacorExplorer>
    </Controls:SinacorDragDrop>

</Controls:SinacorWindow>